package com.lelefly.base.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lelefly.base.model.Result;
import com.lelefly.base.po.FarmlandAccess;
import com.lelefly.base.po.FarmlandSpray;
import com.lelefly.base.po.FarmlandTask;
import com.lelefly.base.serviceImp.FarmlandAccessService;
import com.lelefly.base.serviceImp.FarmlandSprayService;
import com.lelefly.base.serviceImp.FarmlandTaskService;

@Controller
@RequestMapping("/farminfo")
public class FarmlandTaskController extends BaseController{

	@Resource
	public FarmlandTaskService farmlandTaskService;
	
	

	@SuppressWarnings({ "rawtypes", "unchecked" })
	@RequestMapping(value="/getFarmlandTask",produces="application/json;charset=utf-8")
	@ResponseBody
	public Result getFarmlandTask(String usernm){
		Result<FarmlandAccess> result=null;
		try {
			result = farmlandTaskService.getFarmlandTask(usernm);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			getLogger().info("----->>"+e.getLocalizedMessage());
		}
		return result;
	}
	
	
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	@RequestMapping(value="/addFarmlandTask",produces="application/json;charset=utf-8")
	@ResponseBody
	public Result addFarmlandTask(FarmlandTask farmlandTask){
		Result<FarmlandAccess> result=null;
		try {
			result = farmlandTaskService.addFarmlandTask(farmlandTask);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			getLogger().info("----->>"+e.getLocalizedMessage());
		}
		return result;
	}
	

	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	@RequestMapping(value="/delFarmlandTask",produces="application/json;charset=utf-8")
	@ResponseBody
	public Result delFarmlandAccesss(String id){
		Result<FarmlandAccess> result=null;
		try {
			result = farmlandTaskService.delFarmlandTask(id);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			getLogger().info("----->>"+e.getLocalizedMessage());
		}
		return result;
	}
	
	
}
